package com.wu.llpsw.yuanli.energy;

import net.minecraft.core.Direction;
import net.minecraft.nbt.CompoundTag;
import net.minecraftforge.common.capabilities.Capability;
import net.minecraftforge.common.capabilities.ICapabilitySerializable;
import net.minecraftforge.common.util.LazyOptional;
import org.jetbrains.annotations.NotNull;
/**
 * 提供该能量的使用
 */
public class powerBody implements ICapabilitySerializable<CompoundTag> {
    private final power instance=new power();

    @Override
    public CompoundTag serializeNBT() {
        return instance.serializeNBT();
    }

    @Override
    public void deserializeNBT(CompoundTag compoundNBT) {
        this.instance.deserializeNBT(compoundNBT);
    }

    @NotNull
    @Override
    public <T> LazyOptional<T> getCapability(@NotNull Capability<T> capability, @org.jetbrains.annotations.Nullable Direction direction) {
        return capability==CapabilityRegistryHandler.POWER?LazyOptional.of(()->this.instance).cast() :LazyOptional.empty();
    }
}
